package com.platform.controller.backend;

import com.platform.base.BaseController;
import com.platform.common.Const;
import com.platform.common.ServerResponse;
import com.platform.util.StringUtil;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/synDataController/")
@CrossOrigin(origins = Const.REQUESTURL,maxAge = 3600,allowCredentials = "true")
public class SynDataController extends BaseController {

    @GetMapping("synPsac0001.do")
    public ServerResponse<String> synPsac0001(){
        return iSynDataService.synPsac0001();
    }

    @GetMapping("synPsac0002.do")
    public ServerResponse<String> synPsac0002(){
        return iSynDataService.synPsac0002();
    }

    @GetMapping("synPsac0009.do")
    public ServerResponse<String> synPsac0009(){
        return iSynDataService.synPsac0009();
    }

    @GetMapping("synUserInfo.do")
    public ServerResponse<String> synUserInfo(){
        return iSynDataService.synUserInfo();
    }

    @GetMapping("synRole.do")
    public ServerResponse<String> synRole(){
        return iSynDataService.synRole();
    }

    @GetMapping("synUserRole.do")
    public ServerResponse<String> synUserRole(){
        return iSynDataService.synUserRole();
    }

    /**
     * 同步专家信息
     * @return
     */
    @GetMapping("synPsad0001.do")
    public ServerResponse<String> synPsad0001(){
        return iSynDataService.synPsad0001();
    }


    /**
     * 同步招标人信息
     * @return
     */
    @GetMapping("synPsaa0001.do")
    public ServerResponse<String> synPsaa0001(){
        return iSynDataService.synPsaa0001();
    }


    /**
     * 同步枚举信息
     * @param dictCode
     * @return
     */
    @GetMapping("synPsad0002.do")
    public ServerResponse<String> synPsad0002(@RequestParam(value = "dictCode") String dictCode){
        return iSynDataService.synPsad0002(dictCode);
    }

    @GetMapping("synMeprice.do")
    public ServerResponse<String> synMeprice(@RequestParam Map paramMap, HttpServletRequest request){
        return iSynDataService.synMeprice(StringUtil.valueOfString(paramMap.get("startDate")),
                StringUtil.valueOfString(paramMap.get("endDate")));
    }

}
